package com.rivulet.doj_backend.mapper;

import com.rivulet.doj_backend.pojo.Competition;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface CompetitionMapper {
    @Select("select * from t_competition where competition_id = #{competition_id}")
    public Competition getCompetitionByCompetitionId(@Param("competition_id")Integer competition_id);

    @Select("select * from r_user_join_competition where user_id = #{userId}")
    public List<String> getCompetitionIdByUserId(@Param("userId")Integer user_id);

    @Insert("insert into r_user_join_competition (competition_id,user_id) values (#{competition_id},#{user_id})")
    public void addCompetition(@Param("competition_id")Integer competition_id,@Param("user_id")Integer user_id);
}
